const express = require('express')
const bodyParser = require('body-parser')
const app = express()
const http = require("http").Server(app);
const io = require("socket.io")(http);

//打包路径
//app.use('/', express.static('./resources/app.asar/dist/'))
//测试路径
app.use('/', express.static('./dist/'))

// see https://github.com/expressjs/body-parser
// 添加 body-parser 中间件就可以了
app.use(bodyParser.urlencoded({
	extended: false
}))
app.use(bodyParser.json())

io.on("connection", function(socket) {
	socket.on('pubSlimeLrc', function(msg) {
		io.emit("subSlimeLrc", msg);
	})
	
	socket.on('pubSlimeLrcDrag', function(msg) {
		io.emit("subSlimeLrcDrag", msg);
	})
})

http.listen(2333, function() {
	console.log('listening on *:2333')
})